package com.uphone.kingmall.activity;

import com.uphone.kingmall.base.BaseActivity;
import com.uphone.kingmall.utils.intent.IntentData;
import com.zaaach.citypicker.CityPicker;
import com.zaaach.citypicker.adapter.OnPickListener;
import com.zaaach.citypicker.model.City;
import com.zaaach.citypicker.model.LocatedCity;

/**
 * <pre>
 *     author : radish
 *     e-mail : 15703379121@163.com
 *     time   : 2019/4/7
 *     desc   :
 * </pre>
 */
public class CitySeletorActivity extends BaseActivity {
    @IntentData
    private String province = "";
    @IntentData
    private String city = "";

    @Override
    public int getLayoutContentId() {
        return com.china.zhuoyue.R.layout.kingmall_activity_city_seletor;
    }

    @Override
    public void initView() {
        CityPicker.from(this)
                .enableAnimation(false)
//                .setAnimationStyle(R.style.DefaultCityPickerAnimation)
                .setLocatedCity(new LocatedCity(city, province, ""))
//                        .setHotCities(hotCities)
                .setOnPickListener(new OnPickListener() {
                    @Override
                    public void onPick(int position, City data) {
                        city = data.getName();


//                        tvCity.setText(city + "");
//                        loadData
                    }

                    @Override
                    public void onCancel() {
                    }

                    @Override
                    public void onLocate() {
                        //开始定位，这里模拟一下定位
//                                new Handler().postDelayed(new Runnable() {
//                                    @Override
//                                    public void run() {
//                                        CityPicker.from(MainActivity.this).locateComplete(new LocatedCity("深圳", "广东", "101280601"), LocateState.SUCCESS);
//                                    }
//                                }, 3000);
                    }
                });
    }

    @Override
    public void initData() {

    }
}
